<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>weboffice demo</title>
    <script type="text/javascript" src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
</head>
<body>
<div id="btn">
    <button id="openFile" class="btn1" onclick="WebOffice.importFile();">打开文件</button>
    <button id="saveFile" class="btn2" onclick="WebOffice.saveToUrl();">保存文件</button>
    <!--<button id="insertStamp">插入图片</button>-->
    <!--<button id="insertShape">插入浮动图片</button>-->
    <!--<button id="deleteShape">删除图片</button>-->
    <button id="showTrace" class="btn" onclick="WebOffice.showRevisions(true);">显示痕迹</button>
    <button id="hideTrace" class="btn" onclick="WebOffice.showRevisions(false);">隐藏痕迹</button>
    <button id="startTrace" class="btnW" onclick="WebOffice.trackRevisions(true);">开始修订</button>
    <button id="endTrace" class="btnW" onclick="WebOffice.trackRevisions(false);">结束修订</button>
    <button id="acceptTrace" class="btnW" onclick="WebOffice.acceptAllRevisions();">接收痕迹</button>
    <button id="rejectTrace" class="btnW" onclick="WebOffice.rejectAllRevisions();">拒接痕迹</button>

    <!--    <button id="protect" class="btn">保护文档</button>-->
    <!--    <button id="unProtect" class="btn">解除保护文档</button>-->

    <!--    <button  id="getDocContent"  class="btn">获取文档全部内容</button>-->
    <!--<button  id="getPictures"  class="btn">获取文档中的全部图片</button>-->
    <!--<button  id="mouseListen"  class="btn">开启鼠标监听事件</button>-->

    <!--<button  class="btn">隐藏工具栏</button>-->
    <!--<button  class="btn">显示工具栏</button>-->
    <!--<button  class="btn">隐藏菜单栏</button>-->
    <!--<button  class="btn">显示菜单栏</button>-->
    <!--<button  class="btn">隐藏格式栏</button>-->
    <!--<button  class="btn">显示格式栏</button>-->
    <!--<button  class="btn">隐藏格式栏</button>-->
    <!--    <button id="addMarks" class="btnW">添加书签</button>-->
    <!--    <button id="locateMark" class="btnW">定位书签</button>-->
    <!--    <button id="insertValueToMark" class="btnW">在书签位置插入内容</button>-->
    <!--    <button id="getMarkValue" class="btnW">获取书签中的内容</button>-->
    <!--    <button id="print" class="btnW">打印</button>-->

    <!--<button id="setMarksValue" class="btnW">给书签设值</button>-->
    <br>

</div>

<div id="weboffice" style="width: 100%;"></div>
<script type="text/javascript">
    $(function () {
        $("#weboffice").height(window.innerHeight - $("#btn").height() - 30);
        // const options={"contextPath":"/gwgl","customToolbar":false,"extendBookmarks":true,"fileDownloadUrl":"/gwgl/a/gwgl/gongwenchuliRereirong/download?dataPath=undefined%3Aundefined","menubar":false,"officeToolbars":true,"openMode":"docNormalEdit","pluginType":"ntko","productCaption":"岳阳市人民政府","productKey":"A166FC8BC7588BCD5D813FBF02596D09DF477613","serverPage":"/gwgl/officeServer","tagId":"PageOfficeCtrl1","titlebar":false,"userName":"程钢"}
        // WebOffice.init("weboffice",options).then(function (initResult){
        //             console.log(initResult);
        //         })
        $.get("/weboffice/officeControl/ntko").then(function (result) {
            WebOffice.init("weboffice", result).then(function (initResult) {
                console.log(initResult);
            })
            // webWps.init("weboffice", result).then(wresult => {
            //     console.log(wresult);
            // })
        })

        window.onresize = function () {
            $("#weboffice").height(window.innerHeight - $("#btn").height() - 30);
        }
    })

    function onWordBookmarkClick(name, value) {
        console.log("name:" + name + "-----value:" + value);
    }
</script>

</body>
</html>